const mongoose = require('mongoose');

const { Schema, model } = mongoose;


const answerSchema = new Schema({
  __v: { type: Number, select: false },
  content: { type: String, required: true },
  answerer: { type: Schema.Types.ObjectId, ref: 'User', required: true, select: false },
  // 这个就不做引用了（objectId）
  questionId: { type: String, required: true },
  voteCount: { type: Number, required: true, default: 0 },
  createTime: {
    type: Date,
    select: false,
    default: Date.now
  },
  updateTime: {
    type: Date,
    select: false,
    default: Date.now
  }
}, { timestamps: { createdAt: 'createTime', updatedAt: 'updateTime' } });


module.exports = model('Answer', answerSchema);